package com.zhsj.OkeHomeConsumption.other;

import android.app.AlertDialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.WindowManager;

import com.zhsj.OkeHomeConsumption.R;


/**
 * <p>文件描述：<p>
 * <p>作者：xingdx<p>
 * <p>创建时间：2018/11/14<p>
 * <p>更改时间：2018/11/14<p>
 */
public class MDialog extends AlertDialog {
    public MDialog(@NonNull Context context) {
        super(context, R.style.ActionSheetDialogStyle);
    }

    @Override
    public void show() {
        super.show();
/**
 * 设置宽度全屏，要设置在show的后面
 */
        WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
        layoutParams.gravity = Gravity.BOTTOM;
        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
        layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        getWindow().getDecorView().setPadding(0, 0, 0, 0);
        layoutParams.horizontalMargin = 0;
        getWindow().setAttributes(layoutParams);

    }
}

